<?php

class Stack {

	var $stack;

	function Stack ($stack = array()) 
	{
		$this->stack = $stack;
	}
	
	function push ($elem) 
	{
		$this->stack[] = $elem;
	}
	
	function pop ()
	{
		array_pop($this->stack);
	}
	
	function top ($depth = 1)
	{
		$this->stack[count($this->stack) - $depth];
	}

}

?>
